package com.winhxd.b2c.order.service;

import com.winhxd.b2c.common.context.CustomerUser;
import com.winhxd.b2c.common.domain.order.condition.*;
import com.winhxd.b2c.common.domain.order.model.OrderInfo;
import com.winhxd.b2c.common.domain.order.model.OrderRebateRecord;
import com.winhxd.b2c.common.domain.order.vo.OrderDetailVO;
import com.winhxd.b2c.common.domain.order.vo.OrderInfoVO;
import com.winhxd.b2c.common.domain.order.vo.OrderReadVO;
import com.winhxd.b2c.common.domain.order.vo.OrderRebateRecordVO;

import java.util.List;

/**
* @author hjw
* @date 2019/1/8 18:28
* @Description 订单操作
*/
public interface OrderService {

    /**
     * 创建订单
     * @param condition
     */
    OrderInfo createOrder(CustomerUser customer,OrderCreateCondition condition);

    /**
    * @author hjw
    * @date 2019/1/9 10:01
    * @param record
    * @Description   根据订单编码更改订单状态
    * @return
    */
    int updateByOrderNo(OrderInfo record);
    /**
    * @author hjw
    * @date 2019/1/9 11:38
    * @param condition
    * @Description 用户撤回售后申请
    * @return
    */
    void orderRevokeAfterSale(OrderStartAfterSaleCondition condition);

    /**
     * @author hjw
     * @date 2019/1/9 11:38
     * @param condition
     * @Description 用户发起售后申请
     * @return
     */
    void startAfterSale(OrderStartAfterSaleCondition condition);

    /**
    * @author hjw
    * @date 2019/1/9 16:54
    * @param orderNo
    * @Description 根据订单编码查询订单信息
    * @return
    */
    OrderInfo selectByOrderNo(String orderNo);

    /**
     * @author wangxiaoshun
     * 取消订单
     * @param customer
     * @param condition
     */
    void cancelOrderByCustomer(CustomerUser customer, OrderCancelCondition condition);

    /**
     * 计算订单收益
     * @param orderInfo
     * @param type true 创建订单 false 转正订单
     */
    @Deprecated
    List<OrderRebateRecordVO> orderCalculateRevenue(OrderInfo orderInfo, Boolean type);

    /**
     * @author wangxiaoshun
     * 预订单
     * @param customer
     * @param condition
     */
    OrderReadVO readyOrder(CustomerUser customer, OrderReadyCondition condition);

    /**
     * @author wangxiaoshun
     * @param order
     * @param cancelReason
     * @param extendStatus
     * @param cancelType
     * @param cancelCode
     */
    void orderCancel(OrderInfo order, String cancelReason,Integer status, Integer extendStatus, Integer cancelType, String cancelCode,String operationProperty);

    /**
     * 订单收益计算
     * @param orderInfo
     * @param orderDetailVOS
     * @param type true 创建 false 转正
     * @return
     */
    @Deprecated
    List<OrderRebateRecord> orderRebateRecordCalculate(OrderInfo orderInfo, List<OrderDetailVO> orderDetailVOS, Boolean type);

    /**
     *
     * @param orderNo
     * @return
     */
    OrderInfoVO selectInfoByOrderNo(String orderNo);

    /**
     * 订单完成
     * @author wangxiaoshun
     * @param orderInfo
     */
    void orderComplete(OrderInfo orderInfo);

    /**
     * 发送订单闭环事件
     * @param orderNo
     */
    void  orderFinishSendEvent(String orderNo);


    /**
     * 根据订单查询订单奖励
     * @param orderNo
     * @return
     */
    List<OrderRebateRecord> getOrderRebateRecordVO(String orderNo);
    /**
     * 修改订单实际收益
     * @author wangxiaoshun
     * @param condition
     */
    OrderInfo modifyOrderRebateRecord(OrderRebateRecordCondition condition);

    /**
    * @author hjw
    * @date 2019/1/16 10:27
    * @param orderBaseConditions
    * @Description  手动确认收货
    * @return
    */
    void manualReceived(OrderBaseConditions orderBaseConditions);

    /**
     * @author hjw
     * @date 2019/1/16 10:27
     * @param orderBaseConditions
     * @Description  手动确认收货
     * @return
     */
    void manualReceivedv2(OrderBaseConditions orderBaseConditions);
}
